package com.example.mobile2130606012zxx0414;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class CarLineAdapter extends RecyclerView.Adapter<CarLineAdapter.ViewHolder>{
    private String[]carLineNo={"轿车车型生产环节1","轿车车型生产环节2"};
    private String[]carLineName={"轿车汽车放置底盘","轿车汽车左前悬挂"};
    public CarLineAdapter(String[]carLineNo, String[]carLineName){
        this.carLineNo=carLineNo;
        this.carLineName=carLineName;
    }
    class ViewHolder extends RecyclerView.ViewHolder {
        TextView tvCarLineNo,tvCarLineName;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            tvCarLineNo =itemView.findViewById(R.id.tvMainCarLineNo);
            tvCarLineName=itemView.findViewById(R.id.tvMainCarLineName);
        }
    }
    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_rv_main_qiche,parent,false);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.tvCarLineNo.setText(carLineNo[position]);
holder.tvCarLineName.setText(carLineName[position]);
    }

    @Override
    public int getItemCount() {
        return carLineNo.length;
    }


}
